<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class UpdatePasswordResetsForTimestamp extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('password_resets', function (Blueprint $table) {
            // 由于没有安装 composer require doctrine/dbal
            // 无法使用
            // $table->renameColumn('created_at', 'create_time');
            $table->dropColumn(['created_at']);
            $table->timestamp('create_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('password_resets', function (Blueprint $table) {
            // $table->renameColumn('create_time', 'created_at');
            $table->dropColumn(['create_time']);
            $table->timestamp('created_at')->nullable();
        });
    }
}
